#pragma once
#include <map>
#include <string>
#include "ByteBuffer.h"

using namespace std;
struct stKeyDataUnit
{
    DWORD   dwAlgorithm;
    string  strKey;
};

class CKeyFile :public Singleton<CKeyFile>
{
public:
    enum
    {
        eLParam = 5005,
    };
    CKeyFile();
    CKeyFile(HWND hWnd, DWORD msg);
    ~CKeyFile();
    ByteBuffer encrypt(INT64 id);
    INT64 decrypt(ByteBuffer id);
    bool add(CStringA str);
    bool Heart(CStringA str);
    inline sGuid run()
    {
        sGuid id;
        if (!m_backBuf.empty())
        {
            id.data = decrypt(m_backBuf);
        }
        return id;
    }
private:
    typedef map<DWORD, stKeyDataUnit> MapData;
    ByteBuffer m_backBuf;
    MapData m_Data;
    HWND    m_hExe;
    DWORD   m_msg;
};

class CLoginError
{
public:
    DWORD GetErrorCode(string str);
    typedef vector<string> VecErrors;

};